<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.prime.com.tr/ui">

    <h:head>
        <title>Agent - Add Customer</title>
        <link href="style.css" rel="stylesheet" type="text/css"></link>
        <div style="text-align: center;"><h:graphicImage url="/Images/back.png"></h:graphicImage></div>

    </h:head>
    <h:body>
        <h:form prependId="false">
            <div id="wrapper">
                <div id="logo">

                </div>
                <div id="header">
                    <!-- 		<div id="menu">
                    
                            </div>    -->
                </div>
                <div class="page">
                    <div id="page-bgtop">

                        <div id="dummy"></div>
                        <p:panel id="panelsidebar" header="Pages Menu">
                            <ui:include src="MenuAgent.xhtml" /> 
                        </p:panel>

                        <!-- end #sidebar -->

                        <div id="content">
                            <p:panel id="panel" header="Add Customer">
                                <h:panelGrid columns="2">
                                    <h:outputText value="Identity Number:"/>
                                    <p:inputMask mask="99999999999" value="#{agentbean.customer.TC_ID}" required="true" requiredMessage="Cannot be empty!" />
                                    <h:outputText value="Name"/>
                                    <p:inputText value="#{agentbean.customer.name}" required="true" requiredMessage="Cannot be empty!"><f:validator validatorId="com.Validator.NameValidator" /></p:inputText>
                                    <h:outputText value="Surname"/>
                                    <p:inputText value="#{agentbean.customer.surname}" required="true" requiredMessage="Cannot be empty!"><f:validator validatorId="com.Validator.NameValidator" /></p:inputText>
                                    <h:outputText value="Mobile Number:"/>
                                    <p:inputMask value="#{agentbean.customer.gsmNumber}" mask="(999)999-99-99" required="true" requiredMessage="Cannot be empty!" />
                                    <h:outputText value="E-Mail:"/>
                                    <p:inputText value="#{agentbean.customer.eMail}"><f:validator validatorId="com.Validator.EmailValidator" /></p:inputText>
                                    <h:outputText value="Birth Date:"/>
                                    <p:calendar mode="popup" value="#{agentbean.customer.birthDate}" readOnlyInputText="true" />
                                    <h:outputText value="City"/>
                                    <h:selectOneMenu id="city" value="#{agentbean.city}">
                                        <f:selectItem itemLabel="Select City" itemValue="" />
                                        <f:selectItems value="#{agentbean.cities}" />
                                        <p:ajax update="suburbs" 
                                                listener="#{agentbean.handleCityChange}" />
                                    </h:selectOneMenu>

                                    <h:outputText value="District"/>
                                    <h:selectOneMenu id="suburbs" value="#{agentbean.suburb}" >
                                        <f:selectItem itemLabel="Select Suburb" itemValue="" />
                                        <f:selectItems value="#{agentbean.suburbs}" />
                                    </h:selectOneMenu>

                                    <p:commandButton value="Save" action="#{agentbean.addCustomer}" update="panel"></p:commandButton> 	
                                    <p:commandButton value="Reset"></p:commandButton> 	
                                </h:panelGrid>
                                <p:messages/>
                            </p:panel>  

                        </div>
                        <!-- end #content -->

                        <div style="clear: both;">&nbsp;</div>
                    </div>

                    <!-- end #page -->

                </div>
                <div id="footer-bgcontent">
                    <div id="footer" align="center">
                        <p>İstanbul Teknik Üniversitesi - Software Engineering Course - Real Estate Management</p>
                    </div>
                </div>
                <!-- end #footer -->
            </div>

        </h:form>
    </h:body>
</html>